package function;

import book.BookList;

import java.util.Scanner;

public class Borrow implements Function{
    @Override
    public void work(BookList bookList) {
        System.out.println("借书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你要借阅的书籍");
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getOnNum(); i++) {
            if(bookList.getBook(i).getName().equals(name)) {
                System.out.println("成功借出");
                bookList.getBook(i).setOn(true);
                System.out.println(bookList.getBook(i));
                return;
            }
        }
        System.out.println("没有找到");
    }
}
